<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ClassesTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $classesData = [];
        $studentsData = [];
        for ($i = 2012; $i < 2023; $i++) {
            $classesData[] = ['academic_year' => $i];
        }

        foreach ($classesData as $key => $value) {
            $studentsData[] = [
                'class_id' => $key + 1,
                'name'     => '张'.$key
            ];
            $studentsData[] = [
                'class_id' => $key + 1,
                'name'     => '李'.$key
            ];
        }

        DB::table('classes')->insert($classesData);
        DB::table('students')->insert($studentsData);
    }
}
